/**
 * 课程章节相关请求模块
 */

import request from '@/utils/request'

interface SectionForm {
  id?: number | string
  courseId?: number | string
  courseName?: string
  sectionName?: string
  description?: string
  orderNum?: number
  status?: number
}

export const getSectionAndLesson = (courseId: string | number) => {
  return request({
    method: 'GET',
    url: '/boss/course/section/getSectionAndLesson',
    params: {
      courseId
    }
  })
}

/** 通过 sectionId 获取章节信息 */
export const getBySectionId = (sectionId: string | number) => {
  return request({
    method: 'GET',
    url: '/boss/course/section/getBySectionId',
    params: {
      sectionId
    }
  })
}

/** 保存 章节内容 */
export const saveOrUpdateSection = (data: SectionForm) => {
  return request({
    method: 'POST',
    url: '/boss/course/section/saveOrUpdateSection',
    data
  })
}
